const path = require("path");
// const { CleanWebpackPlugin } = require("clean-webpack-plugin");

module.exports = {
    entry: "./src/QGamePlugin.ts",
    mode: "production",
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                use: "ts-loader",
                exclude: /node_modules/,
            },
        ],
    },
    resolve: {
        extensions: [".tsx", ".ts", ".js"],
    },
    output: {
        filename: "QGamePlugin.js",
        path: path.resolve(__dirname, "dist"),
        library: "QGamePlugin",
        libraryTarget: "umd",
        globalObject: "this",
        umdNamedDefine: true,
    },
    externals: {
        phaser: {
            commonjs: "phaser",
            commonjs2: "phaser",
            amd: "phaser",
            root: "Phaser",
        },
    },
    // plugins: [new CleanWebpackPlugin()],
};
